/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Model.Servicios;

import Model.Beans.Book;
import Model.Beans.User;
import Model.DAO.BookDAO;
import java.util.List;

/**
 *
 * @author sixviv
 */
public class BookSrv {
    private BookDAO bDAO = new BookDAO();

    public List<Book> getBooks(User userInst){
        return bDAO.getBooksInstitution(userInst);
    }
    
   public void addBook(Book book){
       bDAO.insertar(book);
   }
   
   public void addBookTags(Book book){
       bDAO.insertBookTags(book);
   }
   


    public List<Book> getBooksSol(User userInst){
        return bDAO.getBooksInstitutionSol(userInst);
    }

    public List<Book> getBooksPen(User userInst){
        return bDAO.getBooksInstitutionPen(userInst);
    }

    public Book getBook(int idBook){
        return bDAO.getBook(idBook);
    }

    public void update(Book book){
        bDAO.actualizar(book);
    }

    public void insert(Book book){
        bDAO.insertar(book);
    }

    public void delete(Book book){
        bDAO.borrar(book);
    }
    
    public List<Book> getBookBy(String listTag, String nombre, String autor, String isbn, String editorial, String year, int idInstitucion){
        String[] tags = listTag.split(" ");
        return bDAO.searchBooks(tags, nombre, autor, isbn, editorial, year, idInstitucion);
    }

}
